<?php

	/**
	 * @package Yomm
	 * @author bsuter
	 *
	 */
	Abstract Class Yomm_Module_Facebook Extends Yomm_Controller {
		
		protected $app_id = null;
		
		protected $app_secret = null;
		
		protected $facebook_page = null;
		
		protected $facebook = null;
		
		public function __construct()
		{
			parent::__construct();	
			
			if(is_null($this->app_id) || is_null($this->app_secret))
				throw new Yomm_Error('the vars $app_id and $app_secret must be given when extending Yomm_Module_Facebook!');
			
			$this->facebook = new Yomm_Facebook_Client($this->app_id, $this->app_secret);
			
		}
		
		protected function getFBPageEvents()
		{
			if(is_null($this->facebook_page))
				throw new Yomm_Error('getFBPageEvents needs the var $facebook_page in the controller!');
				
			$events = $this->facebook->api($this->facebook_page . '/events');

			return $events['data'];
			
		}
		
	}